package com.cauli.account.role.controller;

import com.cauli.account.role.model.dto.RoleVO;
import com.cauli.account.role.service.RoleService;
import com.cauli.utils.util.ResultResponse;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Cauli
 * @date 2023/2/19 15:08
 * @description 角色 前端控制器
 */
@Api(tags = "角色")
@ApiSort(3)
@RestController
@RequestMapping("/role")
public class RoleController {
    @Autowired
    private RoleService roleService;

    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "根据用户ID获取详细信息")
    @GetMapping("/getRoleByUserId/{userId}")
    public ResultResponse<RoleVO> getRoleByUserId(@PathVariable("userId") Long userId) {
        List<RoleVO> roleVOList = roleService.getRoleByUserId(userId);
        return ResultResponse.success().data(roleVOList);
    }
}
